# $Id: PKGBUILD 184338 2013-05-06 10:22:45Z schiv $
# Maintainer: Ray Rashif <schiv@archlinux.org>
# Contributor: Brad Fanella <bradfanella@archlinux.us>
# See .contrib for older/other contributors

pkgname=eric
pkgver=5.3.3
pkgrel=1
pkgdesc="A full-featured Python 3.x and Ruby IDE in PyQt4"
arch=('any')
url="http://eric-ide.python-projects.org/"
license=('GPL3')
depends=('python-qscintilla')
conflicts=('eric5')
provides=('eric5')
replaces=('eric5')
install=$pkgname.install
source=("http://downloads.sourceforge.net/eric-ide/eric5-$pkgver.tar.gz"
        "$pkgname.desktop")
md5sums=('e324dcc478dd34ff7f765d7716fc0c8b'
         '8aa446c29e6de54e85410e040e754c6e')

prepare() {
  cd "$srcdir/eric5-$pkgver"

  # some freedesktop.org compatibility adjustments (referenced at runtime)
  # TODO: check if this is still needed, else move to package()
  for i in $(grep -R "eric5.desktop" . | sed 's/:.*//' | sort -u); do
    sed -i "s/eric5.desktop/eric.desktop/" $i
  done

  # desktop file later needed during build
  rm eric/eric5.desktop
  install -m644 "$srcdir/$pkgname.desktop" eric/$pkgname.desktop
}

package() {
  cd "$srcdir/eric5-$pkgver"

  python install.py -c -b /usr/bin -i "$pkgdir"

  # Remove files conflicting with eric4
  # what are we doing here?
  # TODO: tell upstream to fix their stuff
  #   and allow installation of eric4 + eric5
  #   OR package these files separately eg. 'eric-common'
  rm "$pkgdir/usr/share/qt4/qsci/api/python/zope-2.10.7.api"
  rm "$pkgdir/usr/share/qt4/qsci/api/python/zope-2.11.2.api"
  rm "$pkgdir/usr/share/qt4/qsci/api/python/zope-3.3.1.api"
  rm "$pkgdir/usr/share/qt4/qsci/api/ruby/Ruby-1.8.7.api"

  # some canonical symlinks
  cd "$pkgdir/usr/bin"
  for i in *; do
    ln -s /usr/bin/$i ${i/eric5/eric}
  done
}

# vim:set ts=2 sw=2 et:
